diff options
author | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-07-27 20:09:43 -0300 |
---|---|---|
committer | João Augusto Costa Branco Marado Torres <torres.dev@disroot.org> | 2025-07-27 20:09:43 -0300 |
commit | b40682ace35b590c909e60d0c8c2556496370a51 (patch) | |
tree | c16555866c500e0131ba4a077e9d110ae2646e23 /src/pages/blog/keywords/[...slug].astro | |
parent | 4e2b619fe93ac332c8e238ca5dc03d744d3562bd (diff) |
feat: style keywords page
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/pages/blog/keywords/[...slug].astro')
-rw-r--r-- | src/pages/blog/keywords/[...slug].astro | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/pages/blog/keywords/[...slug].astro b/src/pages/blog/keywords/[...slug].astro deleted file mode 100644 index 724e8b7..0000000 --- a/src/pages/blog/keywords/[...slug].astro +++ /dev/null @@ -1,40 +0,0 @@ ---- -import { type CollectionEntry, getCollection } from "astro:content"; -import Base from "@layouts/Base.astro"; -import BlogCard from "@components/BlogCard.astro"; - -type Props = { posts: CollectionEntry<"blog">[] }; - -export async function getStaticPaths() { - const posts = await getCollection("blog"); - const keywords = [ - ...new Set( - await getCollection("blog").then((x) => - x.flatMap((x) => x.data.keywords) - ), - ).values(), - ]; - return keywords.map((k) => ({ - params: { slug: k }, - props: { - posts: posts.filter((post) => - post.data.keywords.some((i) => i.localeCompare(k) === 0) - ), - }, - })); -} - -const title = "Blog"; -const description = "Latest articles."; - -const posts = Astro.props.posts.sort((a, b) => - new Date(b.data.dateCreated).valueOf() - - new Date(a.data.dateCreated).valueOf() -); ---- - -<Base {title} {description}> - <main> - <h2>Blogue</h2> {posts.map((post) => <BlogCard {...post} />)} - </main> -</Base> |